<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <div id="app">
        <button @click="showStore">显示仓库的内容</button>
        <h1>{{this.$store.state.counter}}</h1>
        <button @click="add">加1</button>
    </div>
</body>
    <script src="./node_modules/vue/dist/vue.js"></script>
    <script src="./node_modules/vuex/dist/vuex.js"></script>
    <script>
        console.log(Vuex);
        
        let store = new Vuex.Store({
            state:{
                counter:222
            },
            mutations:{
                increment:function(state){
                    state.counter+=1;
                }
            }
        })
        let vm = new Vue({
            store,
            el:"#app",
            methods:{
                showStore:function(){
                    console.log(this.$store);
                },
                add:function(){
                    this.$store.commit("increment")
                }
            },
        })
    </script>
</html>